

import React, { useEffect } from "react";
import { Swiper } from "antd-mobile";
import { useAppSelector, useAppDispatch } from "../../../../store";
import { getBannerList } from "../../../../store/sliceReducer/HomeSliceReducer";
const Index: React.FC = () => {
  const dispatch = useAppDispatch();
  const { banners } = useAppSelector((state) => state.home);
  // console.log(banners);
  useEffect(() => {
    dispatch(getBannerList());
  }, [dispatch]);

  return (
    <>
      <Swiper style={{ "--height": "200px" }} autoplay loop>
        {banners &&
          banners.map((item: any, index: number) => (
            <Swiper.Item key={index}>
              <img src={item.imageUrl} style={{width:'100%', height:'100%'}} alt="" />
            </Swiper.Item>
          ))}
      </Swiper>
    </>
  );
};

export default Index;
